package cn.bdqn.utils;

import org.springframework.util.ResourceUtils;

import java.io.FileNotFoundException;

/**
 * @ProjectName: ycbdqn
 * @Package: cn.bdqn.utils
 * @Author: huat
 * @Date: 2020/3/5 13:39
 * @Version: 1.0
 */
public class StaticUrl {
    public static String getUrl(){
        String   systemPath =null;
        try {
             systemPath = ResourceUtils.getURL("classpath:").getPath().replace("%20", " ").replace('/', '\\').substring(1);//从路径字符串中取出工程路径
            systemPath=systemPath.substring(0,systemPath.lastIndexOf("ycbdqn"));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

        int result=systemPath.indexOf("\\");
        if(-1!=result){
            systemPath=systemPath.substring(result).replace("/","\\");

        }
        return systemPath+"image\\";
    }
}
